CONTENTS | INDEX | PREV | NEXT
 asctime

 NAME
  asctime - convert broken down time into standard text

 SYNOPSIS
  char *str = asctime(ts);
  const struct tm *ts;

 FUNCTION
  asctime() converts a broken down time in the tm structure to an
  ascii string and returns a pointer to that string.  The time
  string is formatted like this:

      Mon Dec 8 01:53:33 1987n0

  where n stands for a newline character and 0 is terminating
  nul.

  The string is stored in a static buffer shared by both asctime and
  ctime and so will get overwritten whenever either function is
  called.

 EXAMPLE
  /*
   *  since the string returned by asctime already has a newline on
   *  it we use fputs instead puts.
   */

  #include <stdio.h>
  #include <time.h>

  main()
  {
      time_t t = time(NULL);
      fputs(asctime(localtime(&t)), stdout);
      return(0);
  }

 INPUTS
  struct tm *ts;  pointer to a broken down time structure

 RESULTS
  char *str;  pointer to static string

 SEE ALSO
  time, localtime, strftime, ctime, clock